package cn.sdack.go.common.entities.users;

import cn.sdack.go.common.entities.BaseEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.validator.constraints.Length;

/**
 * 组织团体
 * 集团
 *
 * @author sdack
 * @date 2024/1/10
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "groups")
public class GroupEntity extends BaseEntity {

    @NotNull(message = "ID - 必填",groups = {Set.class})
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NonNull
    @NotNull(message = "名称 - 必填",groups = {Add.class, Set.class})
    @Length(min = 3,max = 250,message = "名称 - 长度不正确",groups = {Add.class, Set.class})
    @Column(length = 250, nullable = false)
    private String name;


    @Length(max = 300,message = "logo - 长度不正确",groups = {Add.class, Set.class})
    @Column(length = 300)
    private String logo;

    // 状态 true 正常
    @Builder.Default
    private Boolean status = true;

    // 组织负责人，用户账号
    @NotNull(message = "组织负责人 - 必填",groups = {Add.class})
    @Column(length = 80, nullable = false)
    private String principal;

}
